﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Extension;
using Common.util;

namespace Common.Dao
{
    public class StockNameDao
    {
        //保存股票
        public static void BatchSaveStocks(Dictionary<String,String> stocks)
        {
            var enumerable = stocks.Select(m => new
            {
                Code = m.Key,
                Name = m.Value
            }).ToList();
            var sql =
                @"replace into `stock_name`(`code`,`name`) values (@Code,@Name)";
            using (var conn = DbUtils.GetHotTopicConnection())
            {
                conn.InsertMultiple(sql, enumerable);
            }
        }
    }
}
